package org.framework.edge.builder.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.framework.edge.builder.application.DockerBuildModuleApplication;
import org.framework.edge.builder.application.command.docker.build.module.*;
import org.framework.edge.builder.application.dto.DockerBuildModuleDTO;
import org.framework.edge.builder.domain.model.docker.builder.module.DockerBuildModule;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;
/**
 * describe 打包模块 
 *
 * @author Jia wei Wu
 * @date 2024/08/13 07:39 晚上
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController 
 **/
@Tag(name = "打包模块提供者")
@EasyController("/docker/build/module")
public class DockerBuildModuleProvider  {

    @Resource
    private DockerBuildModuleApplication dockerBuildModuleApplication;

    /**
     * describe 新增打包模块
     *
     * @param dockerBuildModuleStoryCommand 新增打包模块     
     * @return {@link Result<DockerBuildModule>} 打包模块新增后领域对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "新增打包模块")
    @PostMapping("/story")
    public Result<DockerBuildModule> story(@RequestBody DockerBuildModuleStoryCommand dockerBuildModuleStoryCommand){
        return dockerBuildModuleApplication.story(dockerBuildModuleStoryCommand);
    }
    /**
     * describe 批量新增打包模块
     *
     * @param dockerBuildModuleStoryCommandList 批量新增打包模块     
     * @return {@link Result<List<DockerBuildModule>>} 打包模块新增后领域对象集合     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "批量新增打包模块")
    @PostMapping("/batchStory")
    public Result<List<DockerBuildModule>> batchStory(@RequestBody List<DockerBuildModuleStoryCommand> dockerBuildModuleStoryCommandList){
        return dockerBuildModuleApplication.batchStory(dockerBuildModuleStoryCommandList);
    }
    /**
     * describe 更新打包模块
     *
     * @param dockerBuildModuleUpdateCommand 更新打包模块     
     * @return {@link Result<DockerBuildModule>} 打包模块领域对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "更新打包模块")
    @PutMapping("/updateOne")
    public Result<DockerBuildModule> updateOne(@RequestBody DockerBuildModuleUpdateCommand dockerBuildModuleUpdateCommand){
        return dockerBuildModuleApplication.updateOne(dockerBuildModuleUpdateCommand);
    }
    /**
     * describe 查询单个打包模块
     *
     * @param dockerBuildModuleQueryOneCommand 查询单个打包模块     
     * @return {@link Result<DockerBuildModuleDTO>} 打包模块DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "查询单个打包模块")
    @GetMapping("/findOne")
    public Result<DockerBuildModuleDTO> findOne(@ModelAttribute DockerBuildModuleQueryOneCommand dockerBuildModuleQueryOneCommand){
        return dockerBuildModuleApplication.findOne(dockerBuildModuleQueryOneCommand);
    }
    /**
     * describe 查询多个打包模块
     *
     * @param dockerBuildModuleQueryListCommand 查询多个打包模块     
     * @return {@link Result<List<DockerBuildModuleDTO>>} 打包模块DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "查询多个打包模块")
    @GetMapping("/findList")
    public Result<List<DockerBuildModuleDTO>> findList(@ModelAttribute DockerBuildModuleQueryListCommand dockerBuildModuleQueryListCommand){
        return dockerBuildModuleApplication.findList(dockerBuildModuleQueryListCommand);
    }
    /**
     * describe 分页查询多个打包模块
     *
     * @param dockerBuildModuleQueryListCommand 分页查询多个打包模块     
     * @return {@link Result<LazyPage<DockerBuildModuleDTO>>} 分页打包模块DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "分页查询多个打包模块")
    @GetMapping("/findPage")
    public Result<LazyPage<DockerBuildModuleDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                           @Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute DockerBuildModuleQueryListCommand dockerBuildModuleQueryListCommand){
        return dockerBuildModuleApplication.findPage(size,current,dockerBuildModuleQueryListCommand);
    }
    /**
     * describe 删除打包模块
     *
     * @param dockerBuildModuleRemoveCommand 删除打包模块     
     * @return {@link Result<DockerBuildModule>} 打包模块     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "删除打包模块")
    @DeleteMapping("/remove")
    public Result<DockerBuildModule> remove(@ModelAttribute DockerBuildModuleRemoveCommand dockerBuildModuleRemoveCommand){
        return dockerBuildModuleApplication.remove(dockerBuildModuleRemoveCommand);
    }
}